﻿using badmati.Log.Models;
using Dapper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace badmati.Log.Repository
{
    public class LoginRecordRepository : IGetDataRepository<LoginRecord>
    {
        private IDbConnection connection;
        private LoginRecordRepository()
        {

        }
        public LoginRecordRepository(IDbConnection conn)
        {
            this.connection = conn;
        }

        private IEnumerable<LoginRecord> GetAllRecord()
        {
            var sqlStr = "select * from log_login";
            var list = connection.Query<LoginRecord>(sqlStr);
            return list;
        }

        /// <inheritdoc/>
        public List<LoginRecord> GetAllData()
        {
            var list = GetAllRecord().ToList();
            return list;
        }

        /// <inheritdoc/>
        public List<LoginRecord> GetDataSpan(int start, int count, string sortField, bool sortAsc)
        {
            throw new NotImplementedException();
        }

        /// <inheritdoc/>
        public List<LoginRecord> GetPaginaionData(int pageNuber, int pageSize, string sortField, bool sortOrder)
        {
            throw new NotImplementedException();
        }
    }
}
